package com.hyt.it.ogt.pj.enums;

import lombok.Getter;


/**
 *
 * 题型code
 *
 * @since 2020
 * @author liuhh
 */
@Getter
public enum PaperItemTypeCode {

    ITEM_TYPE_MULTIPLE_CODE("multiple", "多选题"),
    ITEM_TYPE_JUDGMENT_CODE("judgment", "判断题"),
    ITEM_TYPE_SINGLE_CODE("single", "单选题"),
    ITEM_TYPE_SHORT_ANSWER_CODE("short_answer", "简答题"),
    ITEM_TYPE_FILL_IN_BLANKS_CODE("fill_in_blanks", "填空题"),
    ITEM_TYPE_INDEFINITE_CODE("indefinite", "不定项选择题"),
    ITEM_TYPE_COMPOUND_CODE("compound", "复合题"),
    ITEM_TYPE_FORCE_CHOICE_CODE("forced_choice", "迫选-单选"),
    ITEM_TYPE_CLOZE_CODE("cloze", "完型填空题");

    private String code;
    private String msg;

    PaperItemTypeCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    
    public static PaperItemTypeCode getByCode(String code){
        for (PaperItemTypeCode value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;

    }

    public static String getMsgByCode(String code){
        for (PaperItemTypeCode value : values()) {
            if (value.getCode().equals(code)) {
                return value.getMsg();
            }
        }
        return null;

    }
}
